<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$Think.config.site.title} - 自定义菜单</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">
    <link rel="stylesheet" type="text/css" href="{$Think.config.site.resource_url}css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="{$Think.config.site.resource_url}css/style.css">
    <link href="{$Think.config.site.resource_url}css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="{$Think.config.site.resource_url}css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css">
    <link rel="stylesheet" href="{$Think.config.site.resource_url}css/wxcss.css">
</head>
<body>
    <div class="box">
        <div class="main">
            <div class="left l">
                <div class="l_top">
                    <div class="mobile_hd tc">自定义菜单</div>
                </div>
                    <ul class="pre_menu_list l_bottom" id="menuBox" >
                    <?php $count = '';?>
                         <?php if(isset($menus)){ ?>
                         <?php 
                            $count = count($menus['selfmenu_info']['button']);
                         ?>
                                {volist name="$menus['selfmenu_info']['button']" id="v"  key="k"}
                                    <li class="pre_menu_item fanvmenu  globel0{$k}  {switch name="count"} {case value="1"} size1of2 {/case}{case value="2"} size1of3 {/case}{case value="3"} size1of3 {/case}  {/switch} " id="menu_0{$k}" data-id="0{$k}">
                                        <a href="javascript:void(0)" class="pre_menu_link" data-id="0{$k}">{$v['name']}</a>
                                        <div class="sub_pre_menu_box" id="menu0{$k}" style="display: none;">
                                            <ul class="sub_pre_menu_list" id="add_0{$k}">
					    
                                           <?php
						
                                              if(isset($v['sub_button']['list'])){ 
                                                $count2 = count($v['sub_button']['list']);
                                            ?>
                                                   {volist name="$v['sub_button']['list']" id="vv"  key="kk"}
                                                        <li class="jslevel2 selected glmenu globel0{$k} " id="menu0{$k}_{$kk}" data-id="0{$k}_{$kk}"><span class="sub_pre_menu_inner js_sub_pre_menu_inner"><i class="icon20_common sort_gray"></i><span class="js_l2Title">{$vv['name']}</span></span></li>
                                                    {/volist}

                                               <?php }else{ $count2 =''; }  ?>
                                               
                                                <p class="js_addMenuBox01" id="sonNav0{$k}" data-id="0{$k}" {if condition="$count2 > 5 "} style="display: none;" {/if}>
                                                    <a href="javascript:void(0);" class="jsSubView js_addL2Btn" title="最多添加5个子菜单" draggable="false">
                                                        <span class="sub_pre_menu_inner js_sub_pre_menu_inner">
                                                            <i class="icon14_menu_add"></i>
                                                        </span>
                                                    </a>
                                                 </p>
                                                
                                            </ul>
                                            <i class="arrow arrow_out"></i>
                                            <i class="arrow arrow_in"></i>
                                        </div>
                                    </li>
				    
                                {/volist}
                        <?php }?>
                        
                        <p class="js_addMenuBox pre_menu_item grid_item no_extra  {if condition="$count eq ''"} size1of1 {/if} {switch name="count"} {case value="1"}size1of2{/case} {case value="2"}size1of3{/case} {case value="3"}size1of3{/case}" {/switch} id="addmenu"  {if condition="$count eq '3'"} style="display: none;" {/if}>
                            {if condition="$count eq ''"}<a href="javascript:void(0);" class="js_addL1Btn js_addL1Btn1"  title="最多添加3个一级菜单">+ 添加菜单</a>{else /} <a title="最多添加3个一级菜单" class="pre_menu_link js_addL1Btn" draggable="false" href="javascript:void(0);">                            <i class="icon14_menu_add"></i></a>{/if}
                        </p>
                        
                    </ul>
                    <div class="clear"></div>
            </div>
            <div class="right r">
                <form method="post" action="" name="myForm" id="myForm">
                <div class="menu_form_area" id="mainContent">
                    <div  class="menu_initial_tips tips_global" id="default" style="display: block;"></div>
                    <?php if(isset($menus)){ ?>
			              <?php $i = 1; ?>
                       {volist name="$menus['selfmenu_info']['button']" id="v"  key="k"}
                               <?php 
                                    if(!isset($v['type'])){ $v['type']=''; }

                                    if(!isset($v['key'])){ $v['key']='';  }

                                    if(!isset($v['url'])){ $v['url']=''; }
                                    
                                    if(!isset($v['pagepath'])){ $v['pagepath']=''; }
                               ?>
                        <!-- 一级菜单内容部分 -->
                        <div class="portable_editor to_left sonmenu0{$k}" id="fmenu0{$k}" style="display:none">
                           <div class="editor_inner">
                            <div class="global_mod float_layout menu_form_hd js_second_title_bar">
                             <h4 class="global_info">菜单名称</h4>
                             <div class="global_extra">
                              <a href="javascript:void(0);" data-id="" class="deleteALL" title="删除后将重新添加">删除全部菜单</a>　<a href="javascript:void(0);" data-id="0{$k}">删除菜单</a>
                             </div>
                             <div class="clear"></div>
                            </div>
                           </div>
                           <div class="menu_form_bd" id="view">
                            <div id="js_innerNone" style="display: none;" class="msg_sender_tips tips_global">
                             已添加子菜单，仅可设置菜单名称。
                            </div>
                            <div class="frm_control_group js_setNameBox">
                             <label for="" class="frm_label"><strong class="title js_menuTitle">菜单名称</strong></label>
                             <div class="frm_controls"> 
                              <span class="frm_input_box with_counter counter_in append input0{$k}"><input type="text" class="frm_input js_menu_name form-control" name="data0{$k}[name][0]" value="{$v['name']}" required="required" data-id="0{$k}" /></span>
                              <p class="frm_msg fail js_titleEorTips dn" style="display: none;">字数超过上限</p>
                              <p class="frm_msg fail js_titlenoTips dn" style="display: none;">请输入菜单名称</p>
                              <p class="frm_tips js_titleNolTips">字数不超过4个汉字或8个字母</p>
                             </div>
                            </div>
                           </div> 
                           <div class="frm_control_group yjmenu0{$k}" {if condition="$v['type'] eq ''"} style="display: none;"  {/if}>
                            <label for="" class="frm_label"><strong class="title js_menuContent">菜单内容</strong></label> 
                            <div class="frm_controls frm_vertical_pt">
                            <input type="hidden" name="data0{$k}[type][0]" class="frm_radio fradio0{$k}" value="one" {if condition="$v['type'] eq ''"} checked="checked" {/if} id="menuone0{$k}" data-id="0{$k}" /> 
                             <label class="frm_radio_label js_radio_sendMsg selected f1info" data-editing="0"> <i class="icon_radio"></i> <input type="radio" name="data0{$k}[type][0]" class="frm_radio fradio0{$k}" value="txt" data-id="0{$k}" {if condition="$v['type'] eq 'click'"} checked="checked" {/if} id="fkey0{$k}" /><span class="lbl_content">发送消息</span></label>
                             <label class="frm_radio_label js_radio_url f11info" data-editing="0"><i class="icon_radio"></i><input type="radio" name="data0{$k}[type][0]" class="frm_radio fradio0{$k}" value="url" data-id="0{$k}" id="furl0{$k}" {if condition="$v['type'] eq 'view'"} checked="checked" {/if} /><span class="lbl_content">跳转网页</span></label>
                             <label class="frm_radio_label js_radio_url f11info" data-editing="0"> <i class="icon_radio"></i> <input type="radio" name="data0{$k}[type][0]" class="frm_radio fradio0{$k}" value="miniprogram" data-id="0{$k}" id="fxcx0{$k}" {if condition="$v['type'] eq 'miniprogram'"} checked="checked" {/if} /> <span class="lbl_content">跳转小程序</span></label> 
                            </div>
                           </div>
                           <div class="menu_content_container yjmenu0{$k}" >
                            <div class="menu_content url jsMain" id="txt0{$k}" {if condition="$v['type'] eq 'click'"} style="display: block;" {else /} style="display: none;" {/if}> 
                             <p class="menu_content_tips tips_global">订阅者点击该子菜单会显示文本消息</p>
                             <textarea name="data0{$k}[key][0]{$k}" rows="5" cols="50" class="form-control fmvalue0{$k}" style="margin-top: 10px;" id="key0{$k}">{if condition="($v['type'] eq 'click') AND ($v['key'] neq '')"} {$v['key']} {/if}</textarea>
                            </div>
                            <div class="menu_content url jsMain" id="url0{$k}" {if condition="$v['type'] eq 'view'"} style="display: block" {else /} style="display: none" {/if}>
                             <p class="menu_content_tips tips_global">订阅者点击该子菜单会跳到以下链接</p>
                             <div class="frm_control_group" style=" margin-top:10px;">
                              <label for="" class="frm_label">页面地址</label>
                              <div class="frm_controls">
                               <span class="frm_input_box disabled"><input type="url" class="frm_input fmvalue0{$k}" id="urlText0{$k}" name="data0{$k}[url][0]" {if condition="($v['type'] eq 'view') AND ($v['url'] neq '')"} value="{$v['url']}" {/if} /></span>
                               <p class="profile_link_msg_global menu_url mini_tips warn dn js_warn"> 请勿添加其他公众号的主页链接</p>
                              </div>
                             </div>
                            </div> 
                            <div class="menu_content url jsMain" id="miniprogram0{$k}" {if condition="$v['type'] eq 'miniprogram'"} style="display: block" {else /} style="display: none;" {/if}"> 
                             <p class="menu_content_tips tips_global">前提条件是你的公众号已绑定了小程序,订阅者点击该子菜单会跳到以下小程序</p> 
                             <div class="frm_control_group" style=" margin-top:10px;">
                              <label for="" class="frm_label">小程序路径</label>
                              <div class="frm_controls">
                               <span class="frm_input_box disabled"><input type="text" class="frm_input fmvalue0{$k}" name="data0{$k}[path][0]{$k}" id="path0{$k}" {if condition="($v['type'] == 'miniprogram') AND ($v['pagepath'] neq '')"} value="{$v['pagepath']}" {/if} /></span>
                               <p class="profile_link_msg_global menu_url mini_tips warn dn js_warn"> 已选择小程序-本地部署</p>
                              </div>
                             </div>
                             <div class="frm_control_group" style=" margin-top:10px;">
                              <label for="" class="frm_label">备用网页</label>
                              <div class="frm_controls"> 
                               <span class="frm_input_box disabled"> <input type="url" class="frm_input fmvalue0{$k}" name="data0{$k}[burl][0]{$k}" id="burl0{$k}" {if condition="($v['type'] == 'miniprogram') AND ($v['url'] neq '')"} value="{$v['url']}" {/if}/> </span> 
                               <p class="profile_link_msg_global menu_url mini_tips warn dn js_warn"> 旧版本微信客户端无法支持小程序,用户点击菜单时将会打开备用网页</p> 
                              </div> 
                             </div> 
                            </div> 
                           </div> 
                          </div>
				
                        <!-- 当前菜单下的子菜单内容部分 -->
                        <?php if(isset($v['sub_button']['list'])){   ?>
                            {volist name="$v['sub_button']['list']" id="vv"  key="kk"}
                            <?php 
                                    if(!isset($vv['type'])){ $vv['type']=''; }

                                    if(!isset($vv['key'])){ $vv['key']='';  }

                                    if(!isset($vv['url'])){ $vv['url']=''; }
                                    
                                    if(!isset($vv['pagepath'])){ $vv['pagepath']=''; }
                               ?>
                                <div class="portable_editor to_left sonmenu0{$k}" id="fmenu0{$k}_{$kk}" style="display: none;"> 
                                   <div class="editor_inner"> 
                                    <div class="global_mod float_layout menu_form_hd js_second_title_bar"> 
                                     <h4 class="global_info">子菜单名称</h4> 
                                     <div class="global_extra"> 
                                      <a href="javascript:void(0);" data-id="" class="deleteALL" title="删除后将重新添加">删除全部菜单</a>　<a href="javascript:void(0);" data-id="0{$k}_{$kk} ">删除菜单</a> 
                                     </div> 
                                     <div class="clear"></div> 
                                    </div> 
                                   </div> 
                                   <div class="menu_form_bd" id="view"> 
                                    <div id="js_innerNone" style="display: none;" class="msg_sender_tips tips_global">
                                     已添加子菜单，仅可设置菜单名称。
                                    </div> 
                                    <div class="frm_control_group js_setNameBox"> 
                                     <label for="" class="frm_label"><strong class="title js_menuTitle">子菜单名称</strong></label> 
                                     <div class="frm_controls"> 
                                      <span class="frm_input_box with_counter counter_in append input0{$k}_{$kk}"> <input type="text" class="frm_input js_menu_name" name="data0{$k}[name][{$kk}]" value="{$vv['name']}" required="required" required="required" data-id="0{$k}_{$kk}" /> </span> 
                                      <p class="frm_msg fail js_titleEorTips dn" style="display: none;">字数超过上限</p> 
                                      <p class="frm_msg fail js_titlenoTips dn" style="display: none;">请输入菜单名称</p> 
                                      <p class="frm_tips js_titleNolTips">字数不超过5个汉字或8个字母</p>
                                     </div> 
                                    </div> 
                                   </div> 
                                   <div class="frm_control_group"> 
                                    <label for="" class="frm_label"><strong class="title js_menuContent">菜单内容</strong></label> 
                                    <div class="frm_controls frm_vertical_pt"> 
                                     <label class="frm_radio_label js_radio_sendMsg selected f1info" data-editing="0"> <i class="icon_radio"></i> <input type="radio" name="data0{$k}[type][{$kk}]" class="frm_radio" value="txt" id="fkey0{$k}_{$kk}" data-id="0{$k}_{$kk}" {if condition="$vv['type'] eq 'click'"} checked="checked" {/if} /> <span class="lbl_content">发送消息</span> </label> 
                                     <label class="frm_radio_label js_radio_url f11info" data-editing="0"> <i class="icon_radio"></i> <input type="radio" name="data0{$k}[type][{$kk}]" class="frm_radio" value="url" {if condition="$vv['type'] eq 'view'"} checked="checked" {/if} data-id="0{$k}_{$kk}" id="furl0{$k}_{$kk}" /> <span class="lbl_content">跳转网页</span> </label> 
                                     <label class="frm_radio_label js_radio_url f11info" data-editing="0"> <i class="icon_radio"></i> <input type="radio" name="data0{$k}[type][{$kk}]" class="frm_radio" value="miniprogram" data-id="0{$k}_{$kk}" id="fxcx0{$k}_{$kk}" {if condition="$vv['type'] eq 'miniprogram'"} checked="checked" {/if} /> <span class="lbl_content">跳转小程序</span> </label> 
                                    </div> 
                                   </div> 
                                   <div class="menu_content_container"> 
                                    <div class="menu_content url jsMain" id="txt0{$k}_{$kk}" {if condition="$vv['type'] == 'click'"} style="display: block" {else /} style="display: none" {/if} > 
                                     <p class="menu_content_tips tips_global">订阅者点击该子菜单会显示文本消息</p> 
                                     <textarea name="data0{$k}[key][{$kk}]" class="form-control" rows="5" cols="50" style="margin-top: 10px;" id="key0{$k}_{$kk}">{if condition="($vv['type'] == 'click') AND ($vv['key'] neq '')"} {$vv['key']} {/if}</textarea> 
                                    </div> 
                                    <div class="menu_content url jsMain" id="url0{$k}_{$kk}" {if condition="$vv['type'] == 'view'"} style="display: block" {else /} style="display: none" {/if}> 
                                     <p class="menu_content_tips tips_global">订阅者点击该子菜单会跳到以下链接</p> 
                                     <div class="frm_control_group" style=" margin-top:10px;"> 
                                      <label for="" class="frm_label">页面地址</label> 
                                      <div class="frm_controls"> 
                                       <span class="frm_input_box disabled"> <input type="url" class="frm_input" {if condition="($vv['type'] == 'view') AND ($vv['url'] neq '')"} value="{$vv['url']}" {/if} name="data0{$k}[url][{$kk}]" id="urlText0{$k}_{$kk}" /> </span> 
                                       <p class="profile_link_msg_global menu_url mini_tips warn dn js_warn"> 请勿添加其他公众号的主页链接</p> 
                                      </div> 
                                     </div> 
                                    </div> 
                                    <div class="menu_content url jsMain" id="miniprogram0{$k}_{$kk}" {if condition="$vv['type'] eq 'miniprogram'"} style="display: block" {else /} style="display: none;" {/if}"> 
                                     <p class="menu_content_tips tips_global">前提条件是你的公众号已绑定了小程序,订阅者点击该子菜单会跳到以下小程序</p> 
                                     <div class="frm_control_group" style=" margin-top:10px;"> 
                                      <label for="" class="frm_label">小程序路径</label> 
                                      <div class="frm_controls"> 
                                       <span class="frm_input_box disabled"> <input type="text" class="frm_input" name="data0{$k}[path][{$kk}]" id="path0{$k}_{$kk}" {if condition="($vv['type'] == 'miniprogram') AND ($vv['pagepath'] neq '')"} value="{$vv['pagepath']}" {/if} /> </span> 
                                       <p class="profile_link_msg_global menu_url mini_tips warn dn js_warn"> 已选择小程序-本地部署</p> 
                                      </div> 
                                     </div> 
                                     <div class="frm_control_group" style=" margin-top:10px;"> 
                                      <label for="" class="frm_label">备用网页</label> 
                                      <div class="frm_controls"> 
                                       <span class="frm_input_box disabled"> <input type="text" class="frm_input" name="data0{$k}[burl][{$kk}]" id="burl0{$k}_{$kk}" {if condition="($vv['type'] == 'miniprogram') AND ($vv['url'] neq '')"} value="{$vv['url']}" {/if} /> </span> 
                                       <p class="profile_link_msg_global menu_url mini_tips warn dn js_warn"> 旧版本微信客户端无法支持小程序,用户点击菜单时将会打开备用网页</p> 
                                      </div> 
                                     </div> 
                                    </div> 
                                   </div> 
                                  </div>  
                            {/volist}
                        <?php } ?>
                			<?php 
                				
                			$i++;
                			
                			?>
                       {/volist} 

                    <?php } ?>
                </div>
                
            </div>
            <div class="clear"></div>
           <?php if(isset($menus)){ ?> 
           <?php $count = count($menus['selfmenu_info']['button']); $i=1; ?>
            {volist name="$menus['selfmenu_info']['button']" id="v"  key="k"}
            
            <?php

                if($count==1 and $i==1){
                    echo "<input type='hidden' name='caidan01' value='0".$k."' id='caidan01' class='caidan01'>";
                    echo "<input type='hidden' name='caidan02' value='' id='caidan02'>";
                    echo "<input type='hidden' name='caidan03' value='' id='caidan03'>";
                }
                if($count==2 and $i==1){
                  echo "<input type='hidden' name='caidan01' value='0".$k."' id='caidan01' class='caidan01'>";
                }else if($count==2 and $i==2){
                  echo "<input type='hidden' name='caidan02' value='0".$k."' id='caidan02' class='caidan02'>";
                  echo "<input type='hidden' name='caidan03' value='' id='caidan03'>";
                }
                if($count==3){
                    echo "<input type='hidden' name='caidan0".$i."' value='0".$k."' id='caidan0".$i."' class='caidan0".$i."'>";
                }

                $i++;

            ?>

            {/volist}

          <?php }else{  ?>
            <input type="hidden" name="caidan01" value="" id="caidan01">
            <input type="hidden" name="caidan02" value="" id="caidan02">
            <input type="hidden" name="caidan03" value="" id="caidan03">
          <?php } ?>
            <div class="bottom_btn"><span id="pubBt" class="btn btn_input btn_primary">
                <button type="submit" id="submit" >保存并发布</button></span></div>
                <span class="editor_arrow_wrp"> 
                    <i class="editor_arrow editor_arrow_out"></i>
                    <i class="editor_arrow editor_arrow_in"></i>
                 </span>
            </div>
    </div></form>
    <script type="text/javascript" src="{$Think.config.site.resource_url}js/jquery.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.6"></script>
    <!-- 自定义js -->
    <!-- Sweet alert -->
    <script src="{$Think.config.site.resource_url}js/plugins/sweetalert/sweetalert.min.js"></script>
    <script type="text/javascript" src="{$Think.config.site.resource_url}js/wechatNav.js"></script>
</body>
</html>